home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / COOKIES.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-27  |  789 b   |  38 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <OSBIND.H>
  9. #include "XA_TYPES.H"
  10.  
  11. /* This module is taken from Stephen Sowerby's AGiLE Library */
  12.  
  13. /*
  14.     GetCookie : Get a cookie with a given code
  15.         code = code to look for
  16.         value = address of where to store cookie value if found
  17.         Return = Success of finding the required cookie
  18. */
  19. short GetCookie(long code,long *value)
  20. {
  21.     long *cookie;
  22.     void *ssp;
  23.  
  24.     ssp = (void*)Super(0L);
  25.     cookie = *((long **) 0x5a0);
  26.     Super(ssp);
  27.     while (*cookie)
  28.     { /* Keep going until we get the terminator cookie */
  29.         if (*cookie==code)
  30.         { /* We've found the cookie, get value and return success */
  31.             *value = cookie[1];        
  32.             return TRUE;
  33.         }
  34.         cookie += 2;
  35.     }
  36.     return FALSE;
  37. }
  38.